<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div class="weui-panel__hd" id="returnBtn" style="cursor: pointer;left:0;padding-left: .5em;" position="top">&lt 返回列表</div>
<div position="center">
	<div class="page__hd">
		<h2 id="title" class="page__title" style="margin: 8px;"></h2>
		<p class="page__desc"></p>
	</div>
	<div class="page__bd">
		<article class="weui-article">
			<section>
				<p style="color: gray; text-align: left;">
					<span id="source"></span><br/><span id="pubtime"></span>
				</p>
				<p id="content"></p>
			</section>
		</article>
	</div>
</div>
<script type="text/javascript">
	$(function() {

		wxUtils.showToast();
		wxUtils.loadData({
			isdecode:true,
			urlFun : function() {
				return JSON.stringify({
					"id" : "${id}",
					"method" : "news"
				});
			},
			showFun : function(data) {
				if(data){
					console.info(data);
					if (data.datalist.length > 0) {
						data = data.datalist[0];
						$("#title").html(data['NEWSTITLE']);
						$("#source").html("来源：" + data['NEWSORG']);
						$("#pubtime").html("发布时间：" + data['RELEASETIME']);
						var content = $("<div/>");
				        content.html(data['NEWSCONTENT']);
				        var imgs = content.find("img");
				        $.each(imgs,function(i,img){
				            var obj = $(img);
				            if(parseInt(obj.attr('width'))>300){
				                obj.attr('width','100%').removeAttr('height');
				            }
				        });
				        content.find("p,div,table,tr,td,span,font,h1,h2,h3,h4,h5,br,a").removeAttr('style').removeAttr('class').css({"line-height":"28px"});
						$("#content").html(content.html());
					}
				}else{
					wxUtils.msg("加载数据失败",2,function(){
						wxUtils.returnList();
    				});
				}
				wxUtils.closeToast();
			}
		});

		$("#returnBtn").click(function() {
			wxUtils.returnList();
		});
		
		wxUtils.iniScrollBar();
	});
</script>
